home *** CD-ROM | disk | FTP | other *** search
Wrap
INI File | 1995-11-06 | 15.8 KB | 504 lines
[Variables] ; ; >>> ; >>> BEGINNING OF NLS -- Start translating here. ; >>> ; >>> Do not translate the variable name on the left, only translate the ; >>> quoted string. ; >>> ; $Str_Prompt_MakeDefault = "Do you want to make this your default printer?" $Str_Prompt_TestDrivers = "The installed device drivers can be tested by sending a test page to the printer. Do you wish to try this now?" $Str_Prompt_TestConnection = "Do you want to test the connection between your printer and computer? Make sure the cables are attached first." $Str_Prompt_TestingConnection = "Testing printer connection. Please wait..." $Str_Prompt_PrinterPort = "The driver software works with several different printer models. To function properly, it must know what type of printer is attached.\n\nPlease select your printer model and port below." $Str_Prompt_Port = "Your printer can be connected to your computer through one of the ports listed below.\n\nPlease select the port which you will be using." $Str_Prompt_BothDrivers = "You have installed both language drivers for this printer. Choose one as the default." $Str_CompName_DemoPS = "PostScript Test Pages" ; >>> ; >>> END OF NLS -- Stop translating here ; >>> ; ; The name of the misc scripts directory on the server ; ;$Dir_Scripts = "scripts" ; ; Other globals... ; $Str_Optra_R = "Lexmark Optra R LaserPrinter" $Str_Optra_L = "Lexmark Optra L LaserPrinter" $Str_Optra_LX = "Lexmark Optra Lx LaserPrinter" $Str_Optra_RX = "Lexmark Optra Rx LaserPrinter" $Str_Optra_RT = "Lexmark Optra Rt LaserPrinter" $Str_Optra_Rp = "Lexmark Optra R plus LaserPrinter" $Str_Optra_RTp = "Lexmark Optra Rt plus LaserPrinter" $Str_Optra_LXp = "Lexmark Optra Lx plus LaserPrinter" $Str_Optra_LXIp = "Lexmark Optra Lxi plus LaserPrinter" $Str_Rainbow = "Lexmark Optra C PS2" $Str_OptraN = "Lexmark Optra N" $Str_Sunflower = "Lexmark Sunflower" $Str_Rockwell_150c = "Lexmark WinWriter 150c" $Str_Ruby = "Lexmark Color 4079 plus PS2" $Force_Printer_Type = "" $Printer_Type = $Force_Printer_Type $Force_Port = "" $Port = $Force_Port $Print_Sample = $YES $Printer_Becomes_Default = $YES $ConnectionTested = "N" $MVWinINISection = "MarkVision" ; ; Globals from other scripts. Defining them in this way allows the file to ; still be parsable regardless of the ordering of files. ; $Str_PCL5 = $Str_PCL5 ; pcl.lin $Install_PCL5 = $Install_PCL5 ; pcl.lin $TrueDevice_PCL5 = $TrueDevice_PCL5 ; pcl.lin $Driver_PCL5 = $Driver_PCL5 ; pcl.lin $Str_PostScript = $Str_PostScript ; ps.lin $Install_PostScript = $Install_PostScript ; ps.lin $TrueDevice_PS = $TrueDevice_PS ; ps.lin $Driver_PostScript = $Driver_PostScript ; ps.lin $Str_Rockwell = $Str_Rockwell ; rockdrv.lin $Install_RockwellDriver = $Install_RockwellDriver ; rockdrv.lin $TrueDevice_Rockwell = $TrueDevice_Rockwell ; rockdrv.lin $Driver_Rockwell = $Driver_Rockwell ; rockdrv.lin $ShowSerial = $ShowSerial ; 'product'.lin ; ; Temporary strings ; $TempString = "" $TempString2 = "" $TempString3 = "" [Libraries] PrintUtility = linutil.dll [Disks] PrtSetup = $Str_Disk_Setup, setupdsk.bmp, 255, 0, 0 [Components] DemoPS = $Str_CompName_DemoPS, , $TEMPDIR, PrtSetup, 122, demos.zip ; Server components Server_PrtPort = "", , $SERVERAPPDIR, PrtSetup, 29, (=prtport.lin, =linutil.dll) Server_DemoPS = $Str_CompName_DemoPS, , $SERVERAPPDIR, PrtSetup, 32, demos.zip [Macros] ; ConnectPrinter: This macro connects a printer to a port. ; This is done by setting up the win.ini ; [devices] and [printerports] sections. ; The tricky part is when we have more than ; one device for a given port. ; ; Parameter examples: ; $driver = "ww150c.drv" ; $truedevice = "Lexmark WinWriter 150c" ; $port = "LPT1" ; ConnectPrinter($driver, $truedevice, $port) ( ; First add a colon to the port SetVariable($port, ($port, ":")) ; Internal uses for temp strings: ; ; $TempString Original value of [devices] or [PrinterPorts] entry ; $TempString2 Working copy of $TempString ; $TempString3 "n": driver not being used yet at all ; "u": driver already using this port ; "a": driver exists, we have to add this port ; First, is this driver already being used on a port? GetINI($WININI, "devices", $truedevice, $TempString) SetVariable($TempString2, $TempString) RemoveToken($TempString2, ",", $port) IfEqual($TempString, "", SetVariable($TempString3, "n"), IfEqual($TempString2, $TempString, SetVariable($TempString3, "a"), SetVariable($TempString3, "u"))) ; [devices] IfEqual($TempString3, "n", SetVariable($ConnectPrinter, ($driver, ",", $port)), IfEqual($TempString3, "a", SetVariable($ConnectPrinter, ($TempString, ",", $port)))) IfEqual($TempString3, "u", NOP(), SetINI($WININI, "devices", $truedevice, $ConnectPrinter)) ; [PrinterPorts] GetINI($WININI, "PrinterPorts", $truedevice, $TempString) IfEqual($TempString3, "n", SetVariable($ConnectPrinter, ($ConnectPrinter, ",15,45")), IfEqual($TempString3, "a", SetVariable($ConnectPrinter, ($TempString, ",", $port, ",15,45")))) IfEqual($TempString3, "u", NOP(), SetINI($WININI, "PrinterPorts", $truedevice, $ConnectPrinter)) ) ; MakeDefaultPrinter: Make the given printer the default printer. ; The return value is empty (we use the return ; value for a temporary string.) ; ; The assumption is made that the following external ; variables are already set: ; ; $TrueDevice_PS ; $TrueDevice_PCL5 ; $TrueDevice_Rockwell ; $Str_PCL5 ; $Str_PostScript ; $Str_Rockwell ; $Install_PCL5 ; $Install_PostScript ; $Install_RockwellDriver ; $Driver_PCL5 ; $Driver_PostScript ; $Driver_Rockwell ; MakeDefaultPrinter($printer_type, $port) ( ; Choices: Rockwell, ; PS ; PCL5 ; PS and PCL5 ; ;grw:950801 - This program was never used for Rockwell, so that stuff can ; be removed. Other things could probably also be cleaned-up, such ; as: The passed-in paramter '$printer_type' is not referenced, it ; is SET in the 'Which name?' section below. Besides, it is global. ; IfEqual($Install_RockwellDriver, "Y", SetVariable($MakeDefaultPrinter, $Str_Rockwell), IfEqual($Install_PostScript, "Y", IfEqual($Install_PCL5, "Y", SetVariable($MakeDefaultPrinter, "both"), SetVariable($MakeDefaultPrinter, $Str_PostScript)), SetVariable($MakeDefaultPrinter, $Str_PCL5))) ; When both PS and PCL5 are supported, we need to ask which one they want, ; unless they are in Express Mode, in which case we pick the PCL driver. IfEqual($MakeDefaultPrinter, "both", IfEqual($INSTALLMODE, "E", SetVariable($MakeDefaultPrinter, $Str_PCL5), ChooseFromList($MakeDefaultPrinter, $Str_Prompt_BothDrivers, ($Str_PostScript, $Str_PCL5), $Str_PCL5, , $HelpID_DefaultDriver))) ; Which driver? IfEqual($MakeDefaultPrinter, $Str_PostScript, SetVariable($MakeDefaultPrinter, $Driver_PostScript), IfEqual($MakeDefaultPrinter, $Str_Rockwell, SetVariable($MakeDefaultPrinter, $Driver_Rockwell), SetVariable($MakeDefaultPrinter, $Driver_PCL5))) ; Which name? IfEqual($MakeDefaultPrinter, $Driver_PostScript, SetVariable($printer_type, $TrueDevice_PS), IfEqual($MakeDefaultPrinter, $Driver_PCL5, SetVariable($printer_type, $TrueDevice_PCL5), SetVariable($printer_type, $TrueDevice_Rockwell))) ; Adjust win.ini to reference this as the default SetVariable($MakeDefaultPrinter, ($printer_type, ",", $MakeDefaultPrinter, ",", $port, ":")) SetINI($WinINI, "windows", "device", $MakeDefaultPrinter) ) ; DefaultPrinter: Make this the default printer. ; No return value. ; DefaultPrinter() ( ; Make this the default printer? In "custom" mode, let the user decide, ; in Express mode, always do it, in other modes (driver, etc...) IfEqual($INSTALLMODE, "C", ChooseYesNo($DefaultPrinter, $Str_Prompt_MakeDefault, $YES, $HelpID_DefaultPrinter), IfEqual($INSTALLMODE, "E", SetVariable($DefaultPrinter, $YES), SetVariable($DefaultPrinter, $NO))) IfEqual($DefaultPrinter, $YES, CallMacro(MakeDefaultPrinter, , ($Printer_Type, $Port))) ; Test the device driver? The default response is their response from ; the previous dialog... This is not used for Rockwell. IfEqual($Install_RockwellDriver, "", ChooseYesNo($DefaultPrinter, $Str_Prompt_TestDrivers, $DefaultPrinter, $HelpID_TestDriver), SetVariable($DefaultPrinter, $NO)) IfEqual($DefaultPrinter, $YES, CallMacro(PrintTestPage, , )) ) ; TestConnection: Sends a sample PS file to the printer. ; No return value. ; ; Requires that $Port already be defined. ; TestConnection() ( ; Install the demos to the temporary directory InstallComponent(DemoPS) ; Send the PostScript file to the printer MakePathName($TestConnection, , $TEMPDIR, "feature.ps") ShowMessage($Str_Prompt_TestingConnection) CopyFile($TestConnection, $Port) ; Prevent this from being called again... When CopyFile fails, the ; macro will have been aborted already, so this instruction will not ; to be executed unless we successfully tested the connection. SetVariable($ConnectionTested, "Y") ShowMessage("") ) ; OptraPrinterAndPort: Determine which printer type and port the user ; wishes to connect drivers to. ; No return value. ; OptraPrinterAndPort() ( ; For express, if they have not already choosen a port, use LPT1 by default IfEqual($INSTALLMODE, "E", IfEqual($Port, "", SetVariable($Port, "LPT1"))) ; What type of printer and port? Ask only when the port and printer ; are not already defined. SetVariable($OptraPrinterAndPort, "N") IfEqual($Port, "", SetVariable($OptraPrinterAndPort, "Y"), IfEqual($Printer_Type, "", SetVariable($OptraPrinterAndPort, "Y"))) IfEqual($OptraPrinterAndPort, "Y", CallLibrary(PrintUtility, ChoosePrinterPort, , ($Str_Prompt_PrinterPort, "$Printer_Type", "$Port", $HelpID_PrinterPort, "Y", $Str_Optra_R, $Str_Optra_L, $Str_Optra_LX, $Str_Optra_RX, $Str_Optra_RT))) ; Test the connection? SetVariable($OptraPrinterAndPort, "N") IfEqual($ConnectionTested, "N", ChooseYesNo($OptraPrinterAndPort, $Str_Prompt_TestConnection, "Y", $HelpID_TestConnection)) IfEqual($OptraPrinterAndPort, "Y", CallMacro(TestConnection, , )) ) ; RubyPrinterAndPort: Determine which port the user wishes to connect ; the driver to. No return value. ; RubyPrinterAndPort() ( ; For express, if they have not already choosen a port, ; use LPT1 by default IfEqual($INSTALLMODE, "E", IfEqual($Port, "", SetVariable($Port, "LPT1"))) SetVariable($Printer_Type, $Str_Ruby) ; What port? Ask only when the port is not already defined. IfEqual($Port, "", CallLibrary(PrintUtility, ChoosePrinterPort, , ($Str_Prompt_Port, "$Printer_Type", "$Port", $HelpID_PrinterPort, "Y"))) ; Set the win.ini flag to tell MarkVision which port this is attached to ; grw:950410 - Removing this stuff per SEdwards. This 'paragraph' was ; in golden US-English (Ruby) but won't be in the NLS builds. ; IfEqual($Port, "LPT1", ; SetVariable($RubyPrinterAndPort, "1"), ; IfEqual($Port, "LPT2", ; SetVariable($RubyPrinterAndPort, "2"), ; IfEqual($Port, "LPT3", ; SetVariable($RubyPrinterAndPort, "3"), ; SetVariable($RubyPrinterAndPort, "4")))) ; SetINI($WININI, $MVWinINISection, "InstallPort", $RubyPrinterAndPort) ; Test the connection? ) ; GenPort: Determine which port to connect the driver to. This macro ; should be generic for any printer w/ only one type. ; This macro should be called in place of 'product'printerandport. ; The parameter is THE standard string-name of the printer, as in ; '$Str_Ruby', or '$Str_Rainbow.' ; GenPort($Printer_Name) ( ; For express, if they have not already choosen a port, ; use LPT1 by default IfEqual($INSTALLMODE, "E", IfEqual($Port, "", SetVariable($Port, "LPT1"))) SetVariable($Printer_Type, $Printer_Name) ; What port? Ask only when the port is not already defined. IfEqual($Port, "", CallLibrary(PrintUtility, ChoosePrinterPort, , ($Str_Prompt_Port, "$Printer_Type", "$Port", $HelpID_PrinterPort, $ShowSerial))) ) ; ;; WrigleyPrinterAndPort: Determine which printer type and port the user ;; wishes to connect drivers to. ;; No return value. ;; ;WrigleyPrinterAndPort() ; ( ; ; For express, if they have not already choosen a port, use LPT1 by default ; IfEqual($INSTALLMODE, "E", ; IfEqual($Port, "", SetVariable($Port, "LPT1"))) ; ; ; What type of printer and port? Ask only when the port and printer ; ; are not already defined. ; ;grw:950801 - We don't get here unless we are installing at least one ; ; of the drivers, PS or PCL. If not installing PCL driver, ; ; we don't need to know '$Printer_Type' . ; SetVariable($WrigleyPrinterAndPort, $NO) ; ; IfEqual($Port, "", ; SetVariable($WrigleyPrinterAndPort, $YES), ; IfEqual($Printer_Type, "", SetVariable($WrigleyPrinterAndPort, $YES))) ; ; IfEqual($WrigleyPrinterAndPort, $YES, ; CallLibrary(PrintUtility, ChoosePrinterPort, , ; ($Str_Prompt_PrinterPort, "$Printer_Type", "$Port", ; $HelpID_PrinterPort, $YES, ; $Str_Optra_Rp, $Str_Optra_RTp, $Str_Optra_LXp, $Str_Optra_LXIp))) ; ) ; ; WrigleyPrinterAndPort: Determine which printer type and port the user ; wishes to connect drivers to. ; WrigleyPrinterAndPort() ( ; For express, if they have not already choosen a port, default to LPT1 IfEqual($INSTALLMODE, "E", IfEqual($Port, "", SetVariable($Port, "LPT1"))) ; What type of printer and port? Ask only when the port and printer ; are not already defined. ;grw:950801 - We don't get here unless we are installing at least one ; of the drivers, PS or PCL. If not installing PCL driver, ; we don't need to know '$Printer_Type' . ; Do we need to ask for printer type? SetVariable($TempString, $NO) IfEqual($Printer_Type, "", IfEqual($Install_PCL5, $YES, SetVariable($TempString, $YES))) ; ask for printer & port, just port, or neither? ; We always do port if printer, never just printer. SetVariable($WrigleyPrinterAndPort, "none") IfEqual($TempString, $YES, SetVariable($WrigleyPrinterAndPort, "both"), IfEqual($Port, "", SetVariable($WrigleyPrinterAndPort, "port"))) IfEqual($WrigleyPrinterAndPort, "both", CallLibrary(PrintUtility, ChoosePrinterPort, , ($Str_Prompt_PrinterPort, "$Printer_Type", "$Port", $HelpID_PrinterPort, $YES, $Str_Optra_Rp, $Str_Optra_RTp, $Str_Optra_LXp, $Str_Optra_LXIp)), IfEqual($WrigleyPrinterAndPort, "port", CallLibrary(PrintUtility, ChoosePrinterPort, , ($Str_Prompt_Port, "$Printer_Type", "$Port", $HelpID_PrinterPort, $YES)))) ) ; PrintTestPage: Prints test pages for PS and PCL drivers. ; No return value. PrintTestPage() ( IfEqual($Install_PCL5, $YES, CallMacro(PrintPCLTestPage, , )) IfEqual($Install_PostScript, $YES, CallMacro(PrintPostScriptTestPage, , )) ) ; ForceVariables: Set variables which are influenced by $Force_xxx ; variables to their default state ; ForceVariables() ( SetVariable($Port, $Force_Port) SetVariable($Printer_Type, $Force_Printer_Type) ) ; Initialize: Called before any other macros are run and before any ; GUI stuff is shown. ; The return value is meaningless (used as a temporary string.) ; Initialize() ( ; Initialize some global variables CallMacro(ForceVariables, , ) )